/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NhanVien.java
 *
 * Created on 04-04-2012, 21:33:39
 */
package GUI;

import POJO.NhanVienPoJo;
import javax.swing.JOptionPane;

/**
 *
 * @author tran quoc thinh
 */
public class NhanVien extends javax.swing.JFrame {

    /** Creates new form NhanVien */
    public NhanVien() {
//        initComponents();    
//        jlbThongBao.setText("Xin Chào " + nv.getTenNV());
//        jmnLichChieuMouseClicked(null);
    }

    public NhanVienPoJo nv = new NhanVienPoJo();
    
    public NhanVien(NhanVienPoJo nv1)
    {
        nv = new NhanVienPoJo(nv1);
        initComponents();    
        jlbThongBao.setText("Xin Chào " + nv.getTenNV());
        jmnLichChieuMouseClicked(null);
    }
    
    
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jdpNhanVien = new javax.swing.JDesktopPane();
        jToolBar1 = new javax.swing.JToolBar();
        jlbThongBao = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jmnLichChieu = new javax.swing.JMenu();
        jmnGioiThieuPhim = new javax.swing.JMenu();
        jmnGiaVe = new javax.swing.JMenu();
        jmnQuanLyThongTin = new javax.swing.JMenu();
        jmnDangXuat = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jdpNhanVien.setBackground(new java.awt.Color(204, 204, 204));
        getContentPane().add(jdpNhanVien, java.awt.BorderLayout.CENTER);

        jToolBar1.setRollover(true);
        jToolBar1.setPreferredSize(new java.awt.Dimension(20, 20));

        jlbThongBao.setText("Bạn Chưa Đăng Nhập");
        jToolBar1.add(jlbThongBao);

        getContentPane().add(jToolBar1, java.awt.BorderLayout.PAGE_END);

        jmnLichChieu.setText("Lịch Chiếu");
        jmnLichChieu.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jmnLichChieuMouseClicked(evt);
            }
        });
        jMenuBar1.add(jmnLichChieu);

        jmnGioiThieuPhim.setText("Giới Thiệu Phim");
        jmnGioiThieuPhim.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jmnGioiThieuPhimMouseClicked(evt);
            }
        });
        jMenuBar1.add(jmnGioiThieuPhim);

        jmnGiaVe.setText("Giá Vé");
        jmnGiaVe.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jmnGiaVeMouseClicked(evt);
            }
        });
        jMenuBar1.add(jmnGiaVe);

        jmnQuanLyThongTin.setText("Quản Lý Thông Tin");
        jmnQuanLyThongTin.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jmnQuanLyThongTinMouseClicked(evt);
            }
        });
        jMenuBar1.add(jmnQuanLyThongTin);

        jmnDangXuat.setText("Đăng Xuất");
        jmnDangXuat.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jmnDangXuatMouseClicked(evt);
            }
        });
        jMenuBar1.add(jmnDangXuat);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jmnLichChieuMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmnLichChieuMouseClicked
    
    this.jdpNhanVien.removeAll();
    NV_LichChieuInternalFrame frmLichChieu = new NV_LichChieuInternalFrame(nv);    
    frmLichChieu.setVisible(true);
    jdpNhanVien.add(frmLichChieu);
}//GEN-LAST:event_jmnLichChieuMouseClicked

private void jmnGioiThieuPhimMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmnGioiThieuPhimMouseClicked

    this.jdpNhanVien.removeAll();
    NV_GioiThieuPhimInternalFrame frmGioiThieuPhim = new NV_GioiThieuPhimInternalFrame();
//    for(int i =0; i<this.jdpNhanVien.getAllFrames().length; i++)
//    {
//        //this.jdpNhanVien.getAllFrames()[i].setVisible(false);
//        this.jdpNhanVien.getAllFrames()[i].dispose();
//    }
    frmGioiThieuPhim.setVisible(true);
    jdpNhanVien.add(frmGioiThieuPhim);
}//GEN-LAST:event_jmnGioiThieuPhimMouseClicked

private void jmnGiaVeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmnGiaVeMouseClicked
// TODO add your handling code here:
    this.jdpNhanVien.removeAll();
    NV_GiaVeInternalFrame frmGiaVe = new NV_GiaVeInternalFrame();
    frmGiaVe.setVisible(true);
    jdpNhanVien.add(frmGiaVe);
}//GEN-LAST:event_jmnGiaVeMouseClicked

private void jmnDangXuatMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmnDangXuatMouseClicked
// TODO add your handling code here:
    int kq = JOptionPane.showConfirmDialog(this, "Bạn Có Muốn Đăng Xuất Không?", "Đăng Xuất", JOptionPane.YES_NO_OPTION);
    if(kq == JOptionPane.YES_OPTION)
    {
        this.dispose();
        DangNhap frm = new DangNhap();
        frm.setVisible(true);
        this.jdpNhanVien.add(frm);   
    }
     
}//GEN-LAST:event_jmnDangXuatMouseClicked

private void jmnQuanLyThongTinMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmnQuanLyThongTinMouseClicked
// TODO add your handling code here:
    this.jdpNhanVien.removeAll();
    NV_QuanLyThongTin frm = new NV_QuanLyThongTin(nv);
    frm.setVisible(true);
    frm.nv = new NhanVienPoJo();
    frm.nv = nv;
    jdpNhanVien.add(frm);
}//GEN-LAST:event_jmnQuanLyThongTinMouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(NhanVien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(NhanVien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(NhanVien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(NhanVien.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new NhanVien().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JDesktopPane jdpNhanVien;
    private javax.swing.JLabel jlbThongBao;
    private javax.swing.JMenu jmnDangXuat;
    private javax.swing.JMenu jmnGiaVe;
    private javax.swing.JMenu jmnGioiThieuPhim;
    private javax.swing.JMenu jmnLichChieu;
    private javax.swing.JMenu jmnQuanLyThongTin;
    // End of variables declaration//GEN-END:variables
}
